package com.example.cuibo.i0;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Scanner;

/**
 * Created by cuibo on 2017/11/2.
 */

public class Base64_Pic {

    public void xx()throws IOException{
//        FileInputStream fis = new FileInputStream("a.jpeg");
//        FileOutputStream out = new FileOutputStream("b.jpeg");
//        int b;
//        while ((b = fis.read()) != -1)
//        {
//            out.write(b ^ 123);
//        }
//        fis.close();
//        out.close();
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("1.jpeg"));
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("1.jpeg"));
        int b;
        while ((b = bis.read()) != -1){
            bos.write(b ^ 123);
        }
        bis.close();
        bos.close();
    }

    // 文件的复制
    public void xxx()throws IOException{
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        File file = new File(line);

        FileInputStream fis = new FileInputStream(file);
        FileOutputStream fos = new FileOutputStream(file.getName());

        int b;
        byte[] arr = new byte[1111];
        while ((b = fis.read(arr)) != -1){
            fos.write(arr,0,b);
        }

        fos.close();
        fis.close();
    }


}
